package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.PageResult;
import com.itheima.health.entity.QueryPageBean;
import com.itheima.health.entity.Result;
import com.itheima.health.pojo.Setmeal;
import com.itheima.health.service.SetMealService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ：石破天
 * @date ：Created in 2022年06月07日
 * @description ：
 * @version: 1.0
 */
@RestController
@RequestMapping("/mobile/setmeal")
@Slf4j
@Api(tags = "手机端套餐接口")
public class MobileSetMealController {
@Autowired
    private SetMealService setMealService;
/*
全部套餐查询功能
 */
@GetMapping("/getSetmeal")
    public Result getSetmeal(){
    log.info("---------套餐查询--------------------");
    //调用seervice
   List<Setmeal>list=setMealService.SelectSetmeal();
    //返回全部结果
    return new Result(true,MessageConst.GET_SETMEAL_LIST_SUCCESS,list);
}

/**
 * 手机端--基于套餐id查询套餐详情(套餐的检查组项(检查项))
 *
 * @param id 套餐id
 * @return 返回套餐详情
 */
@GetMapping("/findById")
public Result findByIdSetMeal(Integer id) {
    log.info("基于套餐id查询:{}",id);
    Setmeal setmeal = setMealService.findByIdSetMeal(id);
    return new Result(true,MessageConst.QUERY_SETMEAL_SUCCESS,setmeal);
}
}
